#include<iostream>
using namespace std;

const int N = 1e6 + 10;
int start = 1;
int endss = 1;
int druw[N] = { 0 };
int kind = 0;
int len = 1e7;
int store[2 * N + 1] = { 0 };
int mi_start = 1e7;

int main()
{
	int n, m; cin >> n >> m;
	for (int i = 1; i <= n; i++) cin >> druw[i];
	while (endss <= n)
	{
		if (store[druw[endss]]++ == 0) kind++;
		endss++;
		if (kind == m)
		{
			while (kind == m)
			{
				if (--store[druw[start]] == 0) kind--;
				start++;
				if (len > endss - start + 1)
				{
					len = endss - start + 1;
					mi_start = start - 1;
				}
			}
		}
	}
	cout << mi_start << ' ' << mi_start + len - 1;
	return 0;
}